﻿<ResourceDictionary 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:v="clr-namespace:ShredTheLog.Views;assembly=ShredTheLog.Views"
    xmlns:vm="clr-namespace:ShredTheLog.ViewModels;assembly=ShredTheLog.ViewModels"
    xmlns:cnv="clr-namespace:ShredTheLog.Converters;assembly=ShredTheLog.Converters"
    xmlns:c="clr-namespace:ShredTheLog.Controls;assembly=ShredTheLog.Controls"
    xmlns:tk="clr-namespace:Microsoft.Windows.Controls;assembly=WPFToolkit"
    >

    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="FlashMisc2.xaml"/>
    </ResourceDictionary.MergedDictionaries>

    <DataTemplate DataType="{x:Type vm:ContactListViewModel}">
        <Border Padding="8, 0, 8, 8" Margin="9" Width="700" Style="{StaticResource ShadowedBorderStyle}">
            <Grid HorizontalAlignment="Center" VerticalAlignment="Stretch">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="*"/>
                    <RowDefinition Height="10"/>
                    <RowDefinition Height="220"/>
                </Grid.RowDefinitions>

                <TextBlock Grid.Row="0" Text="{c:LocalizedString s_ContactList}" Style="{StaticResource HeaderStyle}" HorizontalAlignment="Center"  Margin="0, 2, 0, 2"/>
                <tk:DataGrid Grid.Row="1" ItemsSource="{Binding Contacts}">
                    <ItemsControl.ItemContainerStyle>
                        <Style TargetType="{x:Type tk:DataGridRow}">
                            <Setter Property="ContextMenu">
                                <Setter.Value>
                                    <ContextMenu c:Extensions.Items="{Binding Converter={x:Static vm:UserMenuItemsConverter.Default}}" DataContext="{Binding RelativeSource={RelativeSource Mode=Self}, Path=PlacementTarget.DataContext}"/>
                                </Setter.Value>
                            </Setter>
                        </Style>
                    </ItemsControl.ItemContainerStyle>
                    <tk:DataGrid.Columns>
                        <tk:DataGridTemplateColumn Header="{x:Null}" CanUserResize="False" SortMemberPath="Gender">
                            <tk:DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <ContentPresenter Content="{Binding Gender}" HorizontalAlignment="Center"/>
                                </DataTemplate>
                            </tk:DataGridTemplateColumn.CellTemplate>
                        </tk:DataGridTemplateColumn>
                        <tk:DataGridTextColumn Header="{c:LocalizedString s_Name}" Binding="{Binding Name}" Width="*"/>
                        <tk:DataGridTextColumn Header="{c:LocalizedString s_NativeLanguages}" Binding="{Binding Path=KnownLanguages, Converter={x:Static cnv:LanguagesConverter.Default}}" c:Extensions.Comparer="{x:Static cnv:ShortUserInfoByKnownLanguagesComparer.Default}" Width="2*"/>
                        <tk:DataGridTextColumn Header="{c:LocalizedString s_PracticingLanguages}" Binding="{Binding Path=PracticingLanguages, Converter={x:Static cnv:LanguagesConverter.Default}}" c:Extensions.Comparer="{x:Static cnv:ShortUserInfoByPracticingLanguagesComparer.Default}" Width="2*"/>
                        <tk:DataGridTextColumn Header="{c:LocalizedString s_Country}" Binding="{Binding Path=Country, Converter={x:Static cnv:CountryConverter.Default}}" c:Extensions.Comparer="{x:Static cnv:ShortUserInfoByCountryComparer.Default}" Width="*"/>
                        <tk:DataGridTextColumn Header="{c:LocalizedString s_Age}" Binding="{Binding Age}">
                            <tk:DataGridTextColumn.ElementStyle>
                                <Style TargetType="{x:Type TextBlock}">
                                    <Setter Property="TextAlignment" Value="Right"/>
                                </Style>
                            </tk:DataGridTextColumn.ElementStyle>
                        </tk:DataGridTextColumn>
                    </tk:DataGrid.Columns>
                </tk:DataGrid>
                <GridSplitter Grid.Row="2" VerticalAlignment="Center" HorizontalAlignment="Stretch" Focusable="False" Height="3"/>
                <Border Grid.Row="3" BorderThickness="1" BorderBrush="#7480A4" Padding="4" Background="{StaticResource LightGrayBackgroundBrush}" Effect="{StaticResource SmallShadow}">
                    <ContentPresenter Content="{Binding Contacts/, Converter={x:Static vm:UserProfileConverter.Default}}"/>
                </Border>
            </Grid>
        </Border>
    </DataTemplate>
</ResourceDictionary>